<?php

/**
 * Form to create a new topic.
 * @author Dominik Imsirovic
 */

class Application_Form_Topic extends Zend_Form
{

    public function __construct($options = null) {
        parent::__construct($options);
        
        // Set the method for the display form to POST
        $this->setMethod('post');
        
        
        //Add the textarea to name the topic
        $this->addElement('text','topicName',array(
            'label'=>'Choose a name for your topic!',
            'required'=>true,
            'filters' => array('StringTrim'),
             'validators' => array(
                new Zend_Validate_StringLength(array(
                    'min' => 1,
                    'max' => 15 )),new Zend_Validate_Alnum())));
        
        // Add the textarea to describe the topic
        $this->addElement('textarea', 'topicDescription', array(
            'label' => 'Describe your topic!',
            'required' => true,
            'rows' => 5,
            'cols' => 50,
            'validators' => array(
                new Zend_Validate_StringLength(array(
                    'min' => 1,
                    'max' => 200
                )))   
        ));
        
        // Add the Submit button
        $this->addElement('submit', 'submitTopic', array(
            'ignore' => true,
            'label' => 'Submit your topic!'
        ));
        
    }


}
